<?php
session_start();
include 'objects/User.inc';

if (isset($_SESSION['user'])) {
    $user = unserialize($_SESSION['user']);
} else {
    $user = new User();
}
if (!$user->isLogged()) {
    header("Location: index.php");
    exit();
}
include 'objects/Servicio.inc';
?><!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Servicios</title>
        <link rel="stylesheet" type="text/css" href="css/basic.css" />
        <script type="text/javascript" src="script/main.js"></script>
        <style type="text/css">
            body {
                background-color: #CCC;
            }
            body,td,th {
                color: #000;
                text-align: center;
                font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
            }
            table#form {
                text-align: center;
                color: #000;
            }
        </style>
    </head>
    <body><label></label>
        <img alt="logo2" src="img/boulevard.jpg" style="margin-top: 3em;"/><input type="hidden" id="tmp"><br>
    <table width="629" cellspacing="1" cellpadding="3" border="0" align='center'>
      <tr>
            <td width="621" bgcolor="#CA0000"><b><font color="#FFFFFF" size="3" face="verdana, arial, helvetica">INFORME DE SERVICIOS</font></b></td>
      <tr>
            <td height="238" bgcolor="#F5ECB9"><table id="list">
              <thead>
                <tr>
                  <th>Servicio</th>
                  <th>Descripcion</th>
                  <th>Activo</th>
                </tr>
              </thead>
              <tfoot>
                <tr>
                  <td colspan="3"></td>
                </tr>
              </tfoot>
              <tbody>
                <?php
                $ins = new Servicio();
                if ($objs = $ins->getAllBy()) {
                    foreach ($objs as $obj) {
                        $checked = ($obj->activo === '1' ? "checked='checked'" : "");
                        ?>
                <tr>
                  <td><?php echo $obj->servicio; ?></td>
                  <td><?php echo $obj->descripcion; ?></td>
                  <td><input type="checkbox" name="check" value="clientes" <?php echo $checked; ?>/></td>
                </tr>
                <?php
                    }
                } else {
                    echo $ins->msg;
                }
                ?>
              </tbody>
            </table></td>
      </tr>
    </table>
        <input type="button" name="cancelar" id="volver" value="Volver" onclick="window.location = 'menu.php';" style="margin: 3em;"/>
        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0; border-color: #111111; height: 53px" width="100%" id="AutoNumber3">
            <tr>
                <td width="100%" height="26" style="border-style: none; border-width: medium" bgcolor="#CA0000">
                    <p align="center"><b><font face="Arial" size="1" color="#000000">Proyectos Informaticos II /2013</font></b>
                </td>
            </tr>
        </table>
    </body>
</html>